import { Base } from '../../utils/base.js';

class Detail extends Base {
  constructor() {
    var url = Base.baseurl;
    super();//调用基类的构造函数，必须，否则报错
  }
  //获取评论
  getcomment(callBakes,id,page=1) {
    var params = {
      url: 'index/Defaults/getcomment?id=' + id + '&page=' + page,
      callBake: function (res) {
        callBakes(res);
      }
    }
    this.requset(params);
  }
  //获取详细信息
  getGoodsInfo(callBakes, id) {
    var params = {
      url: 'index/Defaults/getGoodsInfo?pid=' + id,
      callBake: function (res) {
        callBakes(res);
      }
    }
    this.requset(params);
  }
  goodsAddCart(callBakes, goods_id, userid, shuxinid) {
    var params = {
      url: 'index/Defaults/addcar?goods_id=' + goods_id + '&user_id=' + userid + '&shuxin_id=' + shuxinid,
      callBake: function (res) {
        callBakes(res);
      }
    }
    this.requset(params);
  }

  //下拉刷新接口
  getpushdownapi(callBakes) {
    var params = {
      url: 'index/Defaults/getAllGodds',
      callBake: function (res) {
        callBakes(res);
      }
    }
    this.requset(params);
  }
  //上拉加载
  getMoregoodsAllList(callBakes, pages) {
    var params = {
      url: 'index/Defaults/getAllGodds?page=' + pages,
      callBake: function (res) {
        callBakes(res);
      }
    }
    this.requset(params);
  }
}
export { Detail };